package com.linshengjian.power.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linshengjian.core.BaseEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.annotations.Where;

import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import java.util.HashSet;
import java.util.Set;

@Accessors(chain = true)
@Data
@Entity(name = "user")
public class UserEntity extends BaseEntity<Integer> {

    private String nickname;

    private String portrait;

    @JsonIgnore
    @ManyToMany
    @Where(clause = "valid = true")
    private Set<RoleEntity> roles = new HashSet<>();

}
